﻿@model etracks.Web.IssueRegistrationViewModel

@using (Html.BeginForm("Edit", "Issue", FormMethod.Post, new { @class = "form-horizontal" }))
{
    <div class="form-group">
        <label for="input_name" class="col-sm-2 control-label">Project</label>
        <div class="col-sm-8">
            <select class="form-control" id="select_project" name="projectid">
                <option value="">No selection</option>
                @foreach (etracks.EntityModels.Project p in Model.ProjectList)
                {
                    <option value="@p.Id" @DataHelper.IsSelected(p.Id, Model.ProjectId)>@p.Name</option>
                }
            </select>
        </div>
    </div>

    <div class="form-group">
        <label for="input_name" class="col-sm-2 control-label">Issue Name</label>
        <div class="col-sm-8">
            <input type="text" class="form-control" id="input_name" name="name" placeholder="eg. A name to easily identify issue" value="@Model.Name" autocomplete="off">
        </div>
    </div>

    <div class="form-group">
        <label for="input_name" class="col-sm-2 control-label">Description</label>
        <div class="col-sm-8">
            <textarea rows="8" class="form-control" id="textarea_description" name="description" placeholder="eg. Description of issue">@Model.Description</textarea>
        </div>
    </div>

    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-8">
            <button type="submit" class="btn btn-default">Save changes</button>

            <button type="button" class="btn btn-default" data-toggle="modal" data-target="#deleteModal">Delete</button>

            @Html.ActionLink("List Issue", "List", "Issue", null, new { @class = "btn btn-default" })

        </div>
    </div>
}
<!-- Modal -->
<div class="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="deleteModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="deleteModalLabel">Delete this issue?</h4>
            </div>
            <div class="modal-body">
                <p>
                    Continuing with this action will remove this record permanently from the system.
                </p>
                <p>
                    Do you want to continue?
                </p>
            </div>
            <div class="modal-footer">
                
                @using (Html.BeginForm("Delete", "Issue", new { id = Model.Id }, FormMethod.Post, new { @class = "form-inline" }))
                {
                    <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
                    <button type="submit" class="btn btn-default">Delete</button>
                }
            </div>
        </div>
    </div>
</div>
